package com.github.catvod.spider.merge;

import java.util.Iterator;

/* loaded from: classes.dex */
abstract class Yj extends ms {
    ms h;

    static class HA extends Yj {
        public HA(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            Lm B;
            return (lm == lm2 || (B = lm2.B()) == null || !this.h.h(lm, B)) ? false : true;
        }

        public String toString() {
            return String.format("%s + ", this.h);
        }
    }

    static class Tw extends Yj {
        public Tw(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            Iterator<Lm> it = lm2.O().iterator();
            while (it.hasNext()) {
                Lm next = it.next();
                if (next != lm2 && this.h.h(lm2, next)) {
                    return true;
                }
            }
            return false;
        }

        public String toString() {
            return String.format(":has(%s)", this.h);
        }
    }

    static class W extends Yj {
        public W(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            if (lm == lm2) {
                return false;
            }
            for (Lm B = lm2.B(); B != null; B = B.B()) {
                if (this.h.h(lm, B)) {
                    return true;
                }
            }
            return false;
        }

        public String toString() {
            return String.format("%s ~ ", this.h);
        }
    }

    static class c extends Yj {
        public c(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            if (lm == lm2) {
                return false;
            }
            for (Lm C4 = lm2.C4(); C4 != null; C4 = C4.C4()) {
                if (this.h.h(lm, C4)) {
                    return true;
                }
                if (C4 == lm) {
                    break;
                }
            }
            return false;
        }

        public String toString() {
            return String.format("%s ", this.h);
        }
    }

    static class d extends Yj {
        public d(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            return !this.h.h(lm, lm2);
        }

        public String toString() {
            return String.format(":not(%s)", this.h);
        }
    }

    static class qM extends ms {
        qM() {
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            return lm == lm2;
        }
    }

    static class yh extends Yj {
        public yh(ms msVar) {
            this.h = msVar;
        }

        @Override // com.github.catvod.spider.merge.ms
        public boolean h(Lm lm, Lm lm2) {
            Lm C4;
            return (lm == lm2 || (C4 = lm2.C4()) == null || !this.h.h(lm, C4)) ? false : true;
        }

        public String toString() {
            return String.format("%s > ", this.h);
        }
    }

    Yj() {
    }
}
